package com.fxd.config;

import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;

import javax.sql.DataSource;

/**
 * @auther fuxudong
 * @date 2021/1/30 - 14:18
 * 和事物相关的配置类
 */
public class transactionconfig {

    /**
     * 用于创建事物管理器对象
     * @param dataSource
     * @return
     */
    @Bean(name = "transactionManager")
    public PlatformTransactionManager creattr(DataSource dataSource){
        return new DataSourceTransactionManager(dataSource);
    }
}
